The invention relates to solving the problems caused by the rope sway of an elevator. A problem in elevators according to prior art, in which roping or ropings is/are connected to the elevator car, has been the sway of the ropes. These types of ropings are, inter alia, the suspension roping of the elevator car and possible compensating roping, which hangs while supported by the elevator car, e.g. between a possible counterweight and the elevator car. Swaying roping causes problems particularly during movement of the elevator car. Sway of the roping acts on the elevator car swinging the car in the lateral direction, owing to its laterally moving mass, which might be transmitted to a passenger, causing discomfort. Lateral forces can also exert additional loads on guide shoes, produce vibration or otherwise disrupt the movement of the car. A swaying rope also produces vertical vibration in the elevator car. At worst, rope sway can result in a dangerous situation, because a strongly swaying rope can in theory become entangled in the structures of the hoistway or even jump out of the groove of a diverting pulley. Minor vibration of the elevator car, although it could be harmless, causes discomfort to passengers and concern about the operation of the elevator. For these reasons, an elevator in solutions according to prior art has been taken out of service during strong swaying. This has been implemented such that sway of the ropings of the elevator has been determined, and when the sway exceeds a limit value, the next run of the elevator car has been prevented until the sway returns back to below the limit value. A problem in solutions according to prior art has been, inter alia, awkward measuring of rope sway directly from the ropes. On the other hand, indirect measurement has also been used, but the solutions have been complicated and in them the elevator has also sometimes been taken out of service unnecessarily. A need has, in fact, arisen for a more advanced solution for preparing for situations of sway of the roping of an elevator.